package com.wwfish.cmsui.modules.sysuser.client;

import com.nexustar.gwt.widgets.client.ui.form.FormContainer;
import com.nexustar.gwt.widgets.client.ui.form.FormElement;
import com.nexustar.gwt.widgets.client.ui.form.FormElementProviderAdpter;
import com.nexustar.gwt.widgets.client.ui.textbox.FishLabelTextAreaBox;
import com.nexustar.gwt.widgets.client.ui.textbox.FishLabelTextBox;
import com.nexustar.gwt.widgets.client.ui.window.PopPanel;
import com.wwfish.cms.model.sysuser.SysRoleDto;

/**
 * Created by IntelliJ IDEA.
 * User: Tom
 * Date: 2010-8-19
 * Time: 9:46:12
 * To change this template use File | Settings | File Templates.
 */
public class RoleWidget {
    private PopPanel panel;
    private FormContainer roleForm;

    public RoleWidget() {
        panel = new PopPanel();

    }

    private void initForm() {
        roleForm = new FormContainer(1);
        final FishLabelTextBox name = new FishLabelTextBox("角色名称:");
        final FishLabelTextAreaBox description = new FishLabelTextAreaBox("角色描述:");
        roleForm.addElement(new FormElement(name, new FormElementProviderAdpter() {
            public void setValue(Object object) {
                name.setValue(((SysRoleDto) object).getName());
            }

            public void getValue(Object object) {
                ((SysRoleDto) object).setName((String) name.getValue());
            }
        }));
        roleForm.addElement(new FormElement(description, new FormElementProviderAdpter() {
            public void setValue(Object object) {
                description.setValue(((SysRoleDto) object).getDescription());
            }

            public void getValue(Object object) {
                ((SysRoleDto) object).setDescription((String) description.getValue());
            }
        }));
    }
}
